package com.google.project.client.HumanResources;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.project.client.Sharing.CreateMessage;
import com.google.project.client.Sharing.MessageDetail;
import com.google.project.client.Sharing.MessageList;
import com.google.project.shared.MessageDTO;
import com.google.project.shared.ProjectDTO;
import com.google.project.shared.TaskRequireDTO;



public class HMEntrypoint implements EntryPoint {

	interface ConnectrAppUiBinder extends UiBinder<DockLayoutPanel, HMEntrypoint> {
	}
//	private final AdmServiceAsync admService = GWT.create(AdmServiceAsync.class);
	private static final ConnectrAppUiBinder binder = GWT.create(ConnectrAppUiBinder.class);
	private static HMEntrypoint singleton;

	
	@UiField ScrollPanel mainPanel;
	RootLayoutPanel root;

	/** Gets the singleton application instance. */
	public static HMEntrypoint get() {
		return singleton;
	}

	@Override
	public void onModuleLoad() {
		singleton = this;
		DockLayoutPanel outer = binder.createAndBindUi(this);
		root = RootLayoutPanel.get();
		root.add(outer);
		mainPanel.add(new HMHomepage());
	}
	
	public void clearMainPanel() {
		mainPanel.clear();
	}
	public void HMStaffList(){
		clearMainPanel();
		mainPanel.add(new HMStaffList());
	}
	public void HMStaffList(int status) {
		clearMainPanel();
		mainPanel.add(new HMStaffList(status));
	}
	public void HMCreateEmp(){
		clearMainPanel();
		mainPanel.add(new HMCreateEmployee());
	}
	public void HMCreateEmp(String userId) {
		clearMainPanel();
		mainPanel.add(new HMCreateEmployee(userId));
	}
	public void HMSkillList(){
		clearMainPanel();
		mainPanel.add(new HMSkillList());
	}
	public void HMAddSkill(){
		clearMainPanel();
		mainPanel.add(new HMAddSkill());
	}
	public void HMAddSkill(String specializeId){
		clearMainPanel();
		mainPanel.add(new HMAddSkill(specializeId));
	}
	public void HMProjectList() {
		clearMainPanel();
		mainPanel.add(new HMProjectList());
	}

	public void HMProjectStaffList(ProjectDTO projectDTO) {
		clearMainPanel();
		mainPanel.add(new HMProjectStaffList(projectDTO));
	}

	public void HMProjectDetail(String projectId) {
		clearMainPanel();
		mainPanel.add(new HMProjectDetail(projectId));
	}

	public void HMStaffForAddProject() {
		clearMainPanel();
		mainPanel.add(new HMStaffForAddProject());
	}
	
	public void HMStaffForAddProject(TaskRequireDTO projectTaskDTO,ProjectDTO projectDTO) {
		clearMainPanel();
		mainPanel.add(new HMStaffForAddProject(projectTaskDTO,projectDTO));
	}
	
	public void HMCreateMessage(){
		clearMainPanel();
		mainPanel.add(new CreateMessage());
	}
	
	public void HMMessList(){
		clearMainPanel();
		mainPanel.add(new MessageList());
	}
	
	public void HMMessDetail(MessageDTO mess){
		clearMainPanel();
		mainPanel.add(new MessageDetail(mess));
	}

	public void HMHomepage() {
		clearMainPanel();
		mainPanel.add(new HMHomepage());
	}
	public void HMHumanReq() {
		clearMainPanel();
		mainPanel.add(new HMHumanReq());
	}
	
//	public void HMHumanReq(int _hmReqStatus) {
//		clearMainPanel();
//		mainPanel.add(new HMHumanReq(_hmReqStatus));
//	}

	public void HMHumanReqDetail(ProjectDTO projectDTO) {
		clearMainPanel();
		mainPanel.add(new HMHumanReqDetail(projectDTO));
	}
}
